package net.cyndeline.scalarlib.rldungeon.dgs.strategy.pointlessArea

import scalax.collection.immutable.Graph
import net.cyndeline.scalarlib.rldungeon.dgs.graph.{DGSFunctionality, Room}
import scalax.collection.GraphEdge.UnDiEdge
import scalax.collection.GraphPredef.OuterEdge
import net.cyndeline.scalarlib.rldungeon.dgs.{ActivatorResponderAmountEstimator, RewardProcessor, ActivatorResponderProcessor}
import scala.reflect.runtime.universe._
import scala.reflect._
import net.cyndeline.scalarlib.rlgraph.util.EdgeCopyFactory
import net.cyndeline.scalarlib.rldungeon.dgs.strategy.pointlessArea.help.StrategyGraphData

/**
 * Reduces the amount of pointless areas in a game map (areas that doesn't need to be visited in order to
 * complete the level).
 */
trait PointlessAreaReductionStrategy {

  /**
   * Produces a graph representation of a map.
   *
   * @param graphData Graph data structures and related data.
   * @param activatorResponderProcessor Modifies rooms and corridors by adding responders and activators to them.
   * @param rewardProcessor Modifies rooms by adding rewards to them.
   * @param edgeFactory Creates new edges from a pair of vertices.
   * @param responderAmount Responsible for computing the amount of responders that should be placed on a map.
   * @return the finished map graph if one was possible to produce according to the strategy, otherwise None.
   */
  def apply[VType <: Room[VType]: ClassTag : TypeTag, EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType] with OuterEdge[X, EType]]
    (graphData: StrategyGraphData[VType, EType],
     activatorResponderProcessor: ActivatorResponderProcessor[VType, EType],
     rewardProcessor: RewardProcessor[VType, EType],
     edgeFactory: EdgeCopyFactory[VType, EType],
     responderAmount: ActivatorResponderAmountEstimator[VType, EType]): Option[Graph[VType, EType]]
}
